-- gain_spell
-- created by panyl
-- 战斗统计规则：获得卷轴

local handle = function(para)
    -- 如果不是在地牢内就忽略
    if not DungeonM.isInDungeon() then
        return;
    end
 
    local classId = para.classId;
    local amount = para.amount;
    if not SpellM.isSpell(classId) then
        return;
    end

    -- 增加进度
    local id = CombatStatM.queryByRule("gain_spell", "id");
    CombatStatM.addProgress(id, amount);
end

-- 获得卷轴事件
EventMgr.register("gain_spell", event.BONUS_ITEM, handle);

return {
    progress = function()
        local id = CombatStatM.queryByRule("gain_spell", "id");
        return CombatStatM.getProgress(id);
    end,
};
